spb/wp-spboucher-ai
Public
1import type { Metadata } from "next";2import Link from "next/link";3import { getLocale } from "@/lib/i18n/server";4import { href, t } from "@/lib/i18n";5import { datasetsWithCounts } from "@/lib/papers/queries";6export const revalidate = 300;7export async function generateMetadata(): Promise<Metadata> { const d = t(await getLocale()); return { title: d.datasets.title, description: d.datasets.lead, alternates: { canonical: "/datasets" } }; }8export default async function DatasetsPage() {9 const locale = await getLocale(); const d = t(locale); const rows = await datasetsWithCounts();10 return (11 <div className="container py-10">12 <h1 className="text-3xl sm:text-4xl">{d.datasets.title}</h1><p className="meta mt-2 max-w-3xl">{d.datasets.lead}</p>13 <div className="overflow-x-auto card mt-8"><table className="data"><thead><tr><th>{d.papers.dataset}</th><th>{d.datasets.provider}</th><th>{d.datasets.coverage}</th><th>{d.datasets.frequency}</th><th>{d.datasets.access}</th><th>{d.topics.papers}</th></tr></thead>14 <tbody>{rows.map((x) => <tr key={x.slug}><td><Link href={href(locale, `/datasets/${x.slug}`)} className="text-fg no-underline hover:underline font-medium">{locale === "fr" ? x.name_fr : x.name_en}</Link></td><td className="text-fg-2">{x.provider ?? "—"}</td><td className="text-fg-2">{x.coverage ?? "—"}</td><td className="text-fg-2">{x.frequency ?? "—"}</td><td><span className={`chip ${x.is_public ? "" : "chip-burgundy"}`}>{x.is_public ? d.datasets.public : d.datasets.restricted}</span></td><td className="whitespace-nowrap">{(x.papers as { slug: string; identifier: string }[]).map((p) => <Link key={p.slug} href={href(locale, `/papers/${p.slug}`)} className="chip no-underline font-mono mr-1">{p.identifier}</Link>)}</td></tr>)}</tbody></table></div>15 </div>16 );17}18